package cn.roderick.web.controller;

import cn.roderick.common.controller.BaseController;
import cn.roderick.web.model.User;
import cn.roderick.web.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import org.springframework.stereotype.Controller;

import java.util.List;

@Controller
@RequestMapping("/user")
public class UserController extends BaseController{

    @Autowired
    UserService userService;

    @RequestMapping(value = "",  method = RequestMethod.GET)
    public ResponseEntity<User> index(){
        User user = userService.selectUserById(1);
        ResponseEntity<User> response = new ResponseEntity<User>(user,HttpStatus.OK);
        return response;
    }

//    @RequestMapping("/list")
//    public ResponseEntity<List<User>> home() {
//        List<User> users = userService.selectAllUser();
//        ResponseEntity<List<User>> response=new ResponseEntity<List<User>>(users,HttpStatus.OK);
//        return  response;
//    }

}
